package com.kkwrite.regimen.common.entity.dto;

import java.io.Serializable;

/** 
 * 验证码服务
 *
 * @author Soosky Wang
 * @date 2018年7月19日 上午11:24:00 
 * @version 1.0.0
 */
public class OutDTO<E> implements Serializable, Cloneable {
	private static final long serialVersionUID = -4997820299854341109L;
	private static final OutDTO BASE = new OutDTO();

	private String success;
	private String msg;
	private String desc;
	private E data;

	public static OutDTO of(String success, String msg) {
		try {
			OutDTO out = (OutDTO) BASE.clone();
			out.setSuccess(success);
			out.setMsg(msg);
			return out;
		} catch (CloneNotSupportedException e) {
			return new OutDTO(success, msg);
		}
	}

	public static OutDTO of(String success, String msg, String desc) {
		try {
			OutDTO out = (OutDTO) BASE.clone();
			out.setSuccess(success);
			out.setMsg(msg);
			out.setDesc(desc);
			return out;
		} catch (CloneNotSupportedException e) {
			return new OutDTO(success, msg, desc);
		}
	}

	@SuppressWarnings("all")
	public static <E> OutDTO<E> of(String success, String msg, String desc, E data) {
		try {
			OutDTO out = (OutDTO) BASE.clone();
			out.setSuccess(success);
			out.setMsg(msg);
			out.setDesc(desc);
			out.setData(data);
			return out;
		} catch (CloneNotSupportedException e) {
			return new OutDTO<>(success, msg, desc, data);
		}
	}
	

	public OutDTO() {
	}
	
	public OutDTO(String success, String msg) {
		this(success, msg, null);
	}
	
	public OutDTO(String success, String msg, String desc) {
		this(success, msg, desc, null);
	}

	public OutDTO(String success, String msg, String desc, E data) {
		this.success = success;
		this.msg = msg;
		this.desc = desc;
		this.data = data;
	}

	public final String getSuccess() {
		return success;
	}
	public final void setSuccess(String success) {
		this.success = success;
	}
	public final String getMsg() {
		return msg;
	}
	public final void setMsg(String msg) {
		this.msg = msg;
	}
	public final String getDesc() {
		return desc;
	}
	public final void setDesc(String desc) {
		this.desc = desc;
	}
	public final E getData() {
		return data;
	}
	public final void setData(E data) {
		this.data = data;
	}

	@Override
	public String toString() {
		return "OutDTO [success=" + success + ", msg=" + msg + ", desc=" + desc
				+ ", data=" + data + "]";
	}
	




}
